{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "\\l htmltable.q\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Define a long table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "lastprice:([sym:100000?`IBM`MSFT`AAPL`GOOG;exch:100000?`A`B`C]time:asc 100000?.z.p;price:10f+100000?10f;size:100*1+100000?10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Display as html table "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style >\n",
       "col.key {\n",
       "\tbackground-color:#ccffff;\n",
       "}\n",
       "col.val {\n",
       "\tbackground-color:#ffffcc;\n",
       "\tforeground-color:red;\n",
       "}\n",
       "</style>\n",
       "<table >\n",
       "<colgroup >\n",
       "<col span=\"2\" class=\"key\"/>\n",
       "<col span=\"3\" class=\"val\"/>\n",
       "</colgroup>\n",
       "<thead >\n",
       "<th >\n",
       "sym\n",
       "</th>\n",
       "<th >\n",
       "exch\n",
       "</th>\n",
       "<th >\n",
       "time\n",
       "</th>\n",
       "<th >\n",
       "price\n",
       "</th>\n",
       "<th >\n",
       "size\n",
       "</th>\n",
       "</thead>\n",
       "<tbody >\n",
       "<tr >\n",
       "<td >\n",
       "`MSFT\n",
       "</td>\n",
       "<td >\n",
       "`C\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D00:23:34.972602912\n",
       "</td>\n",
       "<td >\n",
       "11.58824\n",
       "</td>\n",
       "<td >\n",
       "900\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`AAPL\n",
       "</td>\n",
       "<td >\n",
       "`C\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D01:41:29.023671807\n",
       "</td>\n",
       "<td >\n",
       "13.56016\n",
       "</td>\n",
       "<td >\n",
       "200\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`GOOG\n",
       "</td>\n",
       "<td >\n",
       "`A\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D02:23:22.343989602\n",
       "</td>\n",
       "<td >\n",
       "11.57379\n",
       "</td>\n",
       "<td >\n",
       "1000\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`MSFT\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D04:28:08.968645948\n",
       "</td>\n",
       "<td >\n",
       "13.50636\n",
       "</td>\n",
       "<td >\n",
       "600\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`MSFT\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D08:21:32.800223879\n",
       "</td>\n",
       "<td >\n",
       "15.92621\n",
       "</td>\n",
       "<td >\n",
       "500\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`AAPL\n",
       "</td>\n",
       "<td >\n",
       "`A\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D09:02:37.941443839\n",
       "</td>\n",
       "<td >\n",
       "12.33879\n",
       "</td>\n",
       "<td >\n",
       "700\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`AAPL\n",
       "</td>\n",
       "<td >\n",
       "`A\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D09:41:03.888067288\n",
       "</td>\n",
       "<td >\n",
       "13.28297\n",
       "</td>\n",
       "<td >\n",
       "700\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`MSFT\n",
       "</td>\n",
       "<td >\n",
       "`C\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D11:51:02.930422838\n",
       "</td>\n",
       "<td >\n",
       "17.9018\n",
       "</td>\n",
       "<td >\n",
       "200\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`MSFT\n",
       "</td>\n",
       "<td >\n",
       "`C\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D11:53:38.596409366\n",
       "</td>\n",
       "<td >\n",
       "12.1621\n",
       "</td>\n",
       "<td >\n",
       "900\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`MSFT\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D13:08:17.081055779\n",
       "</td>\n",
       "<td >\n",
       "12.09441\n",
       "</td>\n",
       "<td >\n",
       "600\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`GOOG\n",
       "</td>\n",
       "<td >\n",
       "`C\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D16:25:03.131477796\n",
       "</td>\n",
       "<td >\n",
       "14.24295\n",
       "</td>\n",
       "<td >\n",
       "500\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`GOOG\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D18:08:08.377629506\n",
       "</td>\n",
       "<td >\n",
       "15.43161\n",
       "</td>\n",
       "<td >\n",
       "1000\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`AAPL\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D18:19:40.935196421\n",
       "</td>\n",
       "<td >\n",
       "10.20286\n",
       "</td>\n",
       "<td >\n",
       "300\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`IBM\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D18:52:21.213757372\n",
       "</td>\n",
       "<td >\n",
       "19.98186\n",
       "</td>\n",
       "<td >\n",
       "800\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`GOOG\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D20:41:43.478314116\n",
       "</td>\n",
       "<td >\n",
       "18.83281\n",
       "</td>\n",
       "<td >\n",
       "100\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`AAPL\n",
       "</td>\n",
       "<td >\n",
       "`C\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D20:43:55.665472685\n",
       "</td>\n",
       "<td >\n",
       "11.81453\n",
       "</td>\n",
       "<td >\n",
       "200\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`IBM\n",
       "</td>\n",
       "<td >\n",
       "`C\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D22:13:01.238164370\n",
       "</td>\n",
       "<td >\n",
       "12.37209\n",
       "</td>\n",
       "<td >\n",
       "1000\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`IBM\n",
       "</td>\n",
       "<td >\n",
       "`B\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D22:13:11.823994317\n",
       "</td>\n",
       "<td >\n",
       "10.7064\n",
       "</td>\n",
       "<td >\n",
       "300\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`GOOG\n",
       "</td>\n",
       "<td >\n",
       "`A\n",
       "</td>\n",
       "<td >\n",
       "2000.01.01D23:49:49.194479509\n",
       "</td>\n",
       "<td >\n",
       "13.62771\n",
       "</td>\n",
       "<td >\n",
       "200\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "`AAPL\n",
       "</td>\n",
       "<td >\n",
       "`A\n",
       "</td>\n",
       "<td >\n",
       "2000.01.02D02:41:19.299766811\n",
       "</td>\n",
       "<td >\n",
       "10.04908\n",
       "</td>\n",
       "<td >\n",
       "900\n",
       "</td>\n",
       "</tr>\n",
       "<tr >\n",
       "<td >\n",
       "..\n",
       "</td>\n",
       "<td >\n",
       "..\n",
       "</td>\n",
       "<td >\n",
       "..\n",
       "</td>\n",
       "<td >\n",
       "..\n",
       "</td>\n",
       "<td >\n",
       "..\n",
       "</td>\n",
       "</tr>\n",
       "</tbody>\n",
       "</table>\n",
       "<p >\n",
       "Rows:: 100000\n",
       "Columns:: 5\n",
       "</p>\n"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "maxcols:6\n",
    "maxrows:20\n",
    "displayhtmltab[maxrows;maxcols]lastprice"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Q 3.5",
   "language": "q",
   "name": "qpk"
  },
  "language_info": {
   "file_extension": ".q",
   "mimetype": "text/x-q",
   "name": "q",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
